// vue.config.js

// 这个文件是 vue-cli 创建出来的项目的配置文件
// 在 vue.config.js 这个配置文件中，可以对整个项目的打包、构建进行全局性的配置

// webpack 在进行打包的时候，底层用到了 node.js
// 因此,在 vue.config.js 配置文件中，可以导入并使用 node.js 中的核心模块
const path = require("path");

module.exports = {
    publicPath: "/",
    lintOnSave: false,
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    require("postcss-pxtorem")({
                        // 把px单位换算成rem单位
                        rootValue: 37.5, // vant官方使用的是37.5
                        selectorBlackList: ["vant", "mu"], // 忽略转换正则匹配项
                        propList: ["*"],
                    }),
                ],
            },
        },
    },
    configureWebpack: {
        devServer: {
            port: 8080, //端口
            open: true, //自动打开浏览器
            // Mock数据
            before(app) {
                const bodyParser = require("body-parser");
                app.use(bodyParser.json()); //通过bodyParser获取req.body）
                // 用户信息
                let user = [{
                        userId: 1,
                        userName: "admin",
                        pwd: "123456",
                        tel: 1378888889,
                    },
                    {
                        userId: 2,
                        userName: "李四",
                        pwd: "222222",
                        tel: 1971111111,
                    },
                    {
                        userId: 3,
                        userName: "王五",
                        pwd: "333333",
                        tel: 1552222222,
                    },
                    {
                        userId: 4,
                        userName: "赵六",
                        pwd: "444444",
                        tel: 1752222222,
                    },
                ];
                // 酒店信息
                let hotel = [{
                        hotelId: 1,
                        name: "7天优品",
                        adress: "牡丹广场 西湾路1号",
                        desc: "干净，超棒",
                        indexImage: "https://p0.meituan.net/320.0/tdchoteldark/f37347e253b9ca822a6852c8fa293919296413.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "943",
                        minPrice: 90,
                        num: 3.5,
                    },
                    {
                        hotelId: 2,
                        name: "维斯登精品公寓",
                        adress: "万达广场 E953公寓",
                        desc: "乐于提供各种帮助",
                        indexImage: "https://p0.meituan.net/tdchoteldark/da5f4ebde218813fb9f78962cbac65417852174.jpg",
                        hotelType: "高档型",
                        starLevel: "普通",
                        pinglunCount: "1234",
                        minPrice: 140,
                        num: 4.7,
                    },
                    {
                        hotelId: 3,
                        name: "育明酒店",
                        adress: "开元大道宝龙城市广场 C3栋6楼617室",
                        desc: "服务赞、房间大",
                        indexImage: "https://p1.meituan.net/tdchoteldark/e873646f927373dcb33ce94015f7d787154689.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "2451",
                        minPrice: 85,
                        num: 3.3,
                    },
                    {
                        hotelId: 4,
                        name: "IU酒店",
                        adress: "高铁龙门站西600米",
                        desc: "房间宽敞，卫生好",
                        indexImage: "https://p0.meituan.net/320.0/tdchoteldark/554f3678f6aea3f5b2af0fd2d22f22301399457.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "1224",
                        minPrice: 100,
                        num: 4.8,
                    },
                    {
                        hotelId: 5,
                        name: "山楂树酒店",
                        adress: "王府井 王城大道B区18号",
                        desc: "位置好，服务赞",
                        indexImage: "https://p0.meituan.net/tdchoteldark/10e4e41e671fe8e3913458bc5d01802b1805414.jpg",
                        hotelType: "高档型",
                        starLevel: "四星",
                        pinglunCount: "1335",
                        minPrice: 200,
                        num: 3.7,
                    },
                    {
                        hotelId: 6,
                        name: "雅瑞酒店亚岚公寓",
                        adress: "九都路与定鼎路交叉口东南角水岸国际8栋1单元",
                        desc: "居住感受精致",
                        indexImage: "https://p0.meituan.net/tdchoteldark/7fa96278acd60ae204e486cc223383aa115996.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "1245",
                        minPrice: 85,
                        num: 2.4,
                    },
                    {
                        hotelId: 7,
                        name: "尚客优酒店",
                        adress: "开元大道与后载门街东100米",
                        desc: "位置好，床很舒服",
                        indexImage: "https://p0.meituan.net/320.0/hotelbiz/c6d46b09fc70b6c54af9a5a7b5b11081809709.jpg",
                        hotelType: "豪华型",
                        starLevel: "五星",
                        pinglunCount: "421",
                        minPrice: 300,
                        num: 4.1,
                    },
                    {
                        hotelId: 8,
                        name: "零点时尚酒店",
                        adress: "伊洛路8号201室",
                        desc: "每处都是小细节",
                        indexImage: "https://p0.meituan.net/320.0/tdchoteldark/1e1e34ae50f5274ac74eb676bac95fd4870152.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "252",
                        minPrice: 120,
                        num: 4.2,
                    },
                    {
                        hotelId: 9,
                        name: "苏社精品酒店",
                        adress: "金谷园与沙场路东交叉口北120米路东",
                        desc: "装修风格简约清新",
                        indexImage: "https://p1.meituan.net/320.0/tdchoteldark/6ea8cf4353d3f44205226e235ea556d44133487.jpg",
                        hotelType: "经济型",
                        starLevel: "普通",
                        pinglunCount: "1236",
                        minPrice: 123,
                        num: 4.9,
                    },
                    {
                        hotelId: 10,
                        name: "米兰之家酒店",
                        adress: "开元大道路口东200米",
                        desc: "早餐好，设施齐全",
                        indexImage: "https://p0.meituan.net/320.0/hotelbiz/b6029a00b98f3f285e9dab1e6862a623147280.jpg",
                        hotelType: "舒适型",
                        starLevel: "三星",
                        pinglunCount: "2512",
                        minPrice: 170,
                        num: 3.6,
                    },
                ];
                // 房间信息
                let room = [{
                        roomId: 1,
                        hotelId: 1,
                        roomType: "大床房",
                        price: 105,
                        images: "https://p0.meituan.net/175.0/tdchotel/82fca4508a82cc015d64749017dd100a3601947.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 2,
                        hotelId: 1,
                        roomType: "双人间",
                        price: 136,
                        images: "https://p0.meituan.net/175.0/tdchotel/e409a3c518bf2e3b08531780ab1850d06300441.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 3,
                        hotelId: 1,
                        roomType: "标间",
                        price: 100,

                        images: "https://p0.meituan.net/175.0/tdchotel/e409a3c518bf2e3b08531780ab1850d06300441.jpg",
                        count: 1,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 4,
                        hotelId: 2,
                        roomType: "大床房",
                        price: 123,

                        images: "https://p1.meituan.net/175.0/tdchotel/acab38d2a7f935c88fdc7d00ad1806b96360083.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 5,
                        hotelId: 2,
                        roomType: "双人间",
                        price: 123,

                        images: "https://p1.meituan.net/175.0/tdchotel/711a53376eb87ee70b83c0b38510532b86601.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 6,
                        hotelId: 2,
                        roomType: "单间",
                        price: 324,

                        images: "https://p0.meituan.net/175.0/tdchotel/015ee9cb1e20d4f57a7dee6a7c613eca105975.jpg",
                        count: 1,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 7,
                        hotelId: 3,
                        roomType: "大床房",
                        price: 345,

                        images: "https://p0.meituan.net/175.0/tdchotel/015ee9cb1e20d4f57a7dee6a7c613eca105975.jpg",
                        count: 0,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 8,
                        hotelId: 3,
                        roomType: "双人间",
                        price: 122,

                        images: "https://p0.meituan.net/175.0/tdchotel/383fd1b7db4e9cf8503adf168a8cc2406911751.jpg",
                        count: 1,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 9,
                        hotelId: 3,
                        roomType: "单间",
                        price: 112,

                        images: "https://p1.meituan.net/175.0/tdchotel/fd9bd52a30446ebf4105f2fad7fbd2ff6038227.jpg",
                        count: 4,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 10,
                        hotelId: 4,
                        roomType: "大床房",
                        price: 123,

                        images: "https://p0.meituan.net/175.0/tdchotel/6e41d72483ce323be45b6483429e0da83644782.jpg",
                        count: 5,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 11,
                        hotelId: 4,
                        roomType: "双人间",
                        price: 243,

                        images: "https://p0.meituan.net/175.0/tdchotel/015ee9cb1e20d4f57a7dee6a7c613eca105975.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 12,
                        hotelId: 4,
                        roomType: "单间",
                        price: 123,

                        images: "https://p0.meituan.net/175.0/tdchotel/383fd1b7db4e9cf8503adf168a8cc2406911751.jpg",
                        count: 2,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 13,
                        hotelId: 4,
                        roomType: "动漫房",
                        price: 234,

                        images: "https://p1.meituan.net/175.0/tdchotel/fd9bd52a30446ebf4105f2fad7fbd2ff6038227.jpg",
                        count: 1,
                        personNum: 4,
                        date: []
                    },
                    {
                        roomId: 14,
                        hotelId: 5,
                        roomType: "大床房",
                        price: 123,

                        images: "https://p0.meituan.net/175.0/tdchotel/6e41d72483ce323be45b6483429e0da83644782.jpg",
                        count: 5,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 15,
                        hotelId: 5,
                        roomType: "双人间",
                        price: 213,

                        images: "https://p1.meituan.net/175.0/tdchotel/711a53376eb87ee70b83c0b38510532b86601.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 16,
                        hotelId: 5,
                        roomType: "单间",
                        price: 123,

                        images: "https://p0.meituan.net/175.0/tdchotel/e409a3c518bf2e3b08531780ab1850d06300441.jpg",
                        count: 3,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 17,
                        hotelId: 6,
                        roomType: "大床房",
                        price: 123,

                        images: "https://p0.meituan.net/175.0/tdchotel/e409a3c518bf2e3b08531780ab1850d06300441.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 18,
                        hotelId: 6,
                        roomType: "双人间",
                        price: 234,

                        images: "https://p1.meituan.net/175.0/tdchotel/711a53376eb87ee70b83c0b38510532b86601.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 19,
                        hotelId: 7,
                        roomType: "单间",
                        price: 234,

                        images: "https://p1.meituan.net/175.0/tdchotel/711a53376eb87ee70b83c0b38510532b86601.jpg",
                        count: 1,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 20,
                        hotelId: 7,
                        roomType: "大床房",
                        price: 345,
                        images: "https://p0.meituan.net/175.0/tdchotel/73c39a32a7a7c47ed7b19854bd47040b3773232.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 21,
                        hotelId: 7,
                        roomType: "双人间",
                        price: 342,
                        images: "https://p0.meituan.net/175.0/tdchotel/ab25c4dd5cf5b0d92746211fb7470ee4159621.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 22,
                        hotelId: 8,
                        roomType: "单间",
                        price: 134,
                        images: "https://p0.meituan.net/175.0/tdchotel/ab25c4dd5cf5b0d92746211fb7470ee4159621.jpg",
                        count: 1,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 23,
                        hotelId: 8,
                        roomType: "大床房",
                        price: 456,
                        images: "https://p0.meituan.net/175.0/tdchotel/e409a3c518bf2e3b08531780ab1850d06300441.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 24,
                        hotelId: 8,
                        roomType: "双人间",
                        price: 123,
                        images: "https://p0.meituan.net/175.0/tdchotel/28f73326f4c98da2d9b1538f26d466f691862.jpg",
                        count: 4,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 25,
                        hotelId: 9,
                        roomType: "单间",
                        price: 345,
                        images: "https://p0.meituan.net/175.0/tdchotel/73c39a32a7a7c47ed7b19854bd47040b3773232.jpg",
                        count: 6,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 26,
                        hotelId: 9,
                        roomType: "大床房",
                        price: 567,
                        images: "https://p1.meituan.net/175.0/tdchotel/acab38d2a7f935c88fdc7d00ad1806b96360083.jpg",
                        count: 4,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 27,
                        hotelId: 9,
                        roomType: "双人间",
                        price: 152,
                        images: "https://p0.meituan.net/175.0/tdchotel/015ee9cb1e20d4f57a7dee6a7c613eca105975.jpg",
                        count: 3,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 28,
                        hotelId: 10,
                        roomType: "单间",
                        price: 123,
                        images: "https://p1.meituan.net/175.0/tdchotel/acab38d2a7f935c88fdc7d00ad1806b96360083.jpg",
                        count: 2,
                        personNum: 1,
                        date: []
                    },
                    {
                        roomId: 29,
                        hotelId: 10,
                        roomType: "双人间",
                        price: 345,
                        images: "https://p0.meituan.net/175.0/tdchotel/82fca4508a82cc015d64749017dd100a3601947.jpg",
                        count: 1,
                        personNum: 2,
                        date: []
                    },
                    {
                        roomId: 30,
                        hotelId: 10,
                        roomType: "大床房",
                        price: 234,
                        images: "https://p0.meituan.net/175.0/tdchotel/6e41d72483ce323be45b6483429e0da83644782.jpg",
                        count: 2,
                        personNum: 2,
                        date: []
                    },
                ];
                // 增加房间数量日期
                var date1 = new Date();
                var date2 = new Date(date1);
                date2.setDate(date1.getDate() + 30);
                // console.log(date1, date2);
                for (var i = 0; i < room.length; i++) {
                    for (var k = 0; k <= 30; k++) {
                        var dateNewTime = new Date(date1);
                        dateNewTime.setDate(date1.getDate() + k)
                        dateNewTime = `${dateNewTime.getMonth() + 1}/${dateNewTime.getDate()}`
                            // console.log(dateNewTime);
                        var shuju = { dataTime: dateNewTime, count: room[i].count }
                            // console.log(shuju);
                        room[i].date.push(shuju)
                    }

                }
                // 房屋详情
                let serve = [{
                        hotelId: 1,
                        roomId: 1,
                        serviceId: 1,
                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 1,
                        roomId: 2,
                        serviceId: 2,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 1,
                        roomId: 3,
                        serviceId: 3,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "0",
                    },
                    {
                        hotelId: 2,
                        roomId: 4,
                        serviceId: 4,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 2,
                        roomId: 5,
                        serviceId: 5,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 2,
                        roomId: 6,
                        serviceId: 6,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 1,
                        smoke: "0",
                    },
                    {
                        hotelId: 3,
                        roomId: 7,
                        serviceId: 7,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 3,
                        roomId: 8,
                        serviceId: 8,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 3,
                        roomId: 9,
                        serviceId: 9,

                        breakfast: "0",
                        park: "0",
                        wifi: "0",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "0",
                    },
                    {
                        hotelId: 4,
                        roomId: 10,
                        serviceId: 10,

                        breakfast: "0",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 4,
                        roomId: 11,
                        serviceId: 11,

                        breakfast: "0",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 4,
                        roomId: 12,
                        serviceId: 12,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "0",
                    },
                    {
                        hotelId: 4,
                        roomId: 13,
                        serviceId: 13,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 4,
                        smoke: "0",
                    },
                    {
                        hotelId: 5,
                        roomId: 14,
                        serviceId: 14,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 5,
                        roomId: 15,
                        serviceId: 15,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 5,
                        roomId: 16,
                        serviceId: 16,

                        breakfast: "1",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "1",
                    },
                    {
                        hotelId: 6,
                        roomId: 17,
                        serviceId: 17,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 6,
                        roomId: 18,
                        serviceId: 18,

                        breakfast: "0",
                        park: "0",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 7,
                        roomId: 19,
                        serviceId: 19,

                        breakfast: "0",
                        park: "0",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "30-35㎡1",
                        peopleNum: 1,
                        smoke: "1",
                    },
                    {
                        hotelId: 7,
                        roomId: 20,
                        serviceId: 20,

                        breakfast: "0",
                        park: "0",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 7,
                        roomId: 21,
                        serviceId: 21,

                        breakfast: "0",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 8,
                        roomId: 22,
                        serviceId: 22,

                        breakfast: "1",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "1",
                    },
                    {
                        hotelId: 8,
                        roomId: 23,
                        serviceId: 23,

                        breakfast: "1",
                        park: "0",
                        wifi: "0",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 8,
                        roomId: 24,
                        serviceId: 24,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "1",
                    },
                    {
                        hotelId: 9,
                        roomId: 25,
                        serviceId: 25,

                        breakfast: "1",
                        park: "1",
                        wifi: "1",
                        air: "1",
                        whoAlone: "1",
                        area: "30-35㎡",
                        peopleNum: 1,
                        smoke: "1",
                    },
                    {
                        hotelId: 9,
                        roomId: 26,
                        serviceId: 26,

                        breakfast: "0",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 9,
                        roomId: 27,
                        serviceId: 27,

                        breakfast: "0",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 10,
                        roomId: 28,
                        serviceId: 28,

                        breakfast: "0",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 1,
                        smoke: "0",
                    },
                    {
                        hotelId: 10,
                        roomId: 29,
                        serviceId: 29,

                        breakfast: "0",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "30-35㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                    {
                        hotelId: 10,
                        roomId: 30,
                        serviceId: 30,

                        breakfast: "0",
                        park: "1",
                        wifi: "1",
                        air: "0",
                        whoAlone: "0",
                        area: "40-45㎡",
                        peopleNum: 2,
                        smoke: "0",
                    },
                ];
                // 订单详情
                let order = [{
                        orderId: 1,
                        userName: '张三',
                        hotelId: 1,
                        roomId: 2,
                        start: '1/12',
                        end: '1/14',
                        sum: 3
                    }]
                    // 模拟登陆认证请求
                app.post("/doLogin", (req, res) => {
                    // 拿到请求中的用户名和密码
                    const { username, password } = req.body;
                    if (
                        (username == "admin" && password == "123456") ||
                        (username == "李四" && password == "222222") ||
                        (username == "王五" && password == "333333")
                    ) {
                        res.json({
                            code: 1,
                            token: "mytoken",
                        });
                    } else {
                        res.json({
                            code: -1,
                            msg: "用户名密码错误",
                        });
                    }
                });
                // 首页商品列表接口
                app.get("/getAllProductList", (req, res) => {
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: hotel,
                    });
                });
                // 添加酒店接口
                app.get("/addHotel", (req, res) => {
                    const { form } = req.query;
                    //console.log(form);
                    let rom = JSON.parse(form)
                        //console.log(rom);
                    hotel.push(rom)
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: hotel,
                    });

                });

                // 删除酒店信息接口
                app.get("/deleteHotel", (req, res) => {
                    const { id } = req.query;
                    let room = hotel.findIndex(res => {
                        return id == res.hotelId
                    })
                    hotel.splice(room, 1);
                    res.json({
                        code: 1,
                        msg: '成功',
                        data: hotel,
                    })
                })


                // 修改酒店接口
                app.get("/changeHotel", (req, res) => {
                    const { change } = req.query;
                    // console.log(change);
                    let rom = JSON.parse(change)
                        // console.log(rom);
                    let room = hotel.findIndex(res => {
                        return rom.hotelId == res.hotelId
                    })
                    hotel.splice(room, 1, rom)
                        // console.log(room);
                        // console.log(hotel)
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: hotel,
                    });
                });

                // 房间类型列表接口
                app.get("/getRoomType", (req, res) => {
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: room,
                    });
                });
                // 修改房间日期接口

                // 新增房间信息接口
                app.get("/addRoom", (req, res) => {
                    const { form } = req.query;
                    // console.log(form);
                    let roomList = JSON.parse(form)
                        // console.log(room);
                    room.push(roomList)
                    res.json({
                        code: 1,
                        msg: "新增房间信息成功",
                        data: room,
                    });

                });

                // 删除房间信息接口
                app.get("/deleteRoom", (req, res) => {
                    const { id } = req.query;
                    let roomList = room.findIndex(res => {
                        return id == res.roomId
                    })
                    room.splice(roomList, 1);
                    res.json({
                        code: 1,
                        msg: '删除房间信息成功',
                        data: room,
                    })
                })

                // 修改房间接口
                app.get("/changeRoom", (req, res) => {
                    const { change } = req.query;
                    // console.log(change);
                    let rom = JSON.parse(change)
                        // console.log(rom);
                    var roomsearch = room.findIndex(res => {
                        return rom.roomId == res.roomId
                    })

                    // console.log(roomsearch);
                    // console.log(hotel)
                    room.splice(roomsearch, 1, rom)
                    res.json({
                        code: 1,
                        msg: "修改房间信息成功",
                        data: room,
                    });
                });

                // 获取订单接口
                app.get("/getOrderType", (req, res) => {
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: order,
                    });

                });

                // 添加订单接口
                app.get("/addOrder", (req, res) => {
                    const { userOrder } = req.query;
                    //console.log(form);
                    let rom = JSON.parse(userOrder)
                        // console.log(rom);
                    order.push(rom)
                        // console.log(rom);
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: order,
                    });

                });

                // 房间详情列表接口
                app.get("/getServeType", (req, res) => {
                    res.json({
                        code: 1,
                        msg: "成功",
                        data: serve,
                    });
                });
            },
        },
    },
};